{// 引入标签库 }
<tagLib name="fanwe" />
{// 加载头部公共文件 }
<include file="Public:header" />
<load href="__TMPL__ThemeFiles/Js/jquery.js" />
<load href="__TMPL__ThemeFiles/Js/site.js" />
<!-- 菜单区域  -->

<!-- 主页面开始 -->
<div id="main" class="main" >

<!-- 主体内容  -->
<div class="content" >
<div class="title">{$Think.lang.DATA_LIST}</div>
<!--  功能操作区域  -->
<div class="operate" >
<fanwe:imageBtn name="add" value="{$Think.lang._ADD_DATA}" click="add()" style="impBtn hMargin fLeft shadow" />
<fanwe:imageBtn name="edit" value="{$Think.lang._EDIT_DATA}" click="edit()" style="impBtn hMargin fLeft shadow" />
<fanwe:imageBtn name="delete" value="{$Think.lang._DELETE_DATA}" click="foreverdel()" style="impBtn hMargin fLeft shadow" />
<!-- 查询区域 -->
<div class="fRig">
<form method='post' action="{:u($module_name.'/index')}">
<input type="text" name="keywords" value="{$keywords}" class="medium" >
<select name="is_collect">
	<option value="-1" <if condition="$is_collect eq -1 ">selected</if>>=类型=</value>
    <option value="0" <if condition="$is_collect eq 0">selected</if>>普通</option>
    <option value="1" <if condition="$is_collect eq 1">selected</if>>可采集</option>
</select>
<select name="cate_id" id="cate_id">
	<option value="0">=所有分类=</value>
    <foreach name="siteCates" item="cate">
    <option value="{$cate.id}" <if condition="$cate['id'] eq $cate_id">selected</if>>{$cate.name}</value>
    </foreach>
</select>
<input type="hidden" name="SEARCH_TYPE" value="like" />
<fanwe:imageBtn type="submit" name="search" value="{$Think.lang._SEARCH_DATA}" style="impBtn hMargin fLeft shadow" />
</div>

</div>
<!-- 高级查询区域 -->
<div  id="searchM" class=" none search cBoth" >
</div>
</form>
</div>
<!-- 功能操作区域结束 -->

<!-- 列表显示区域  -->
<div class="list" >
<fanwe:list 
	id="checkList" 
	name="site" 
	style="list" 
	checkbox="true" 
	action="true" 
    isrel="true" 
	datasource="list" 
	child="true" 
	show="id:{$Think.lang.ID}|8%,name:{$Think.lang.NAME}:edit,scname:{$Think.lang.CATEID},site_key:{$Think.lang.KEY},url:{$Think.lang.URL},sort:{$Think.lang.SORT},is_best|getBest:推荐|50,is_auth|getAuth:认证|50,is_all|getAuth:是否全国|50" 
	actionlist="edit_blank:{$Think.lang._EDIT_DATA}:id,foreverdel:{$Think.lang._DELETE_DATA}:id,id|A('Site')->getSiteLinks" /> 
</div>
<!--  分页显示区域 -->
<div class="page">{$page}</div>
<!-- 列表显示区域结束 -->
</div>
<!-- 主体内容结束 -->
</div>
<script type="text/javascript">
CONFIRM_FOREVER_DELETE = "确实要删除选择项吗？\r\n如果该站点有团购商品，请先删除团购商品后再删除站点。";

function edit_blank(id){
	window.open(APP+'?'+VAR_MODULE+'='+CURR_MODULE+'&'+VAR_ACTION+'=edit&id='+id,'_blank');
}

jQuery(function($){
	var bestTooltip = ["未推荐","已推荐"];
	var authTooltip = ["未认证","已认证"];
	var allTooltip = ["非全国显示","全国显示"];
	var images = ["__TMPL__ThemeFiles/Images/locked.gif","__TMPL__ThemeFiles/Images/ok.gif"];
	$("td[rel='is_best|getBest']").click(function(){
		var thisTD = $(this);							 
		var id = $("input",thisTD.parent()).val();
		
		$.ajax({
			url: APP+"?"+VAR_MODULE+"=Site&"+VAR_ACTION+"=updateIsBest&id="+id,
			cache: false,
			success:function(data)
			{
				if(data != "err")
				{
					$("img",thisTD).attr({"src":images[data],"title":bestTooltip[data]});
				}
			}
		});			 
	});
	
	$("td[rel='is_all|getAuth']").click(function(){
		var thisTD = $(this);							 
		var id = $("input",thisTD.parent()).val();
		$.ajax({
			url: APP+"?"+VAR_MODULE+"=Site&"+VAR_ACTION+"=updateIsAll&id="+id,
			cache: false,
			success:function(data)
			{
				if(data != "err")
				{
					$("img",thisTD).attr({"src":images[data],"title":allTooltip[data]});
				}
			}
		});			 
	});
	
	$("td[rel='sort']").each(function(i){
		var thisTD = $(this);
		var sortID = parseInt(thisTD.text());
		var thisInput = $("<input type='text' value='"+sortID+"'>");
		thisTD.html(thisInput);
		thisInput.blur(function(){
			var siteID = $("input",thisTD.parent()).val();
			$.ajax({
				url: APP+"?"+VAR_MODULE+"=Site&"+VAR_ACTION+"=updateSiteSort&id="+siteID+"&sort="+this.value,
				cache: false,
				success:function(data)
				{
				}
			});
		});
	});
	
	$("td[rel='goods_sort']").each(function(i){
		var thisTD = $(this);
		var sortID = parseInt(thisTD.text());
		var thisInput = $("<input type='text' value='"+sortID+"'>");
		thisTD.html(thisInput);
		thisInput.blur(function(){
			var siteID = $("input",thisTD.parent()).val();
			$.ajax({
				url: APP+"?"+VAR_MODULE+"=Site&"+VAR_ACTION+"=updateSite_GoodsSort&id="+siteID+"&sort="+this.value,
				cache: false,
				success:function(data)
				{
				}
			});
		});
		
	});
	
	$("td[rel='is_auth|getAuth']").click(function(){
		var thisTD = $(this);							 
		var id = $("input",thisTD.parent()).val();
		
		$.ajax({
			url: APP+"?"+VAR_MODULE+"=Site&"+VAR_ACTION+"=updateIsAuth&id="+id,
			cache: false,
			success:function(data)
			{
				if(data != "err")
				{
					$("img",thisTD).attr({"src":images[data],"title":authTooltip[data]});
				}
			}
		});			 
	});
});
</script>
<!-- 主页面结束 -->

